MDIWindow Class
Used to configure the MDI window on Multiple Document Interface applications (Windows only). Specify the Multiple Document Interface option in the Properties pane for the App class.
More information available in parent classes: Object
Notes
You have the option of using the Multiple Document Interface (MDI) for the Windows build of your application. If you select this option, all of your application's windows will be enclosed in a "parent" window called the MDI window. If you don't select the MDI interface, then your application will be a Single Document Interface (SDI) application and your application's windows will be directly on the desktop (since there is no MDI window). This class allows you to set certain properties and behaviors of the MDI window.
You can set the MDIWindow property of the App class to a new instance of an MDIWindow subclass. Use this technique to implement the events for an MDIWindow.
Getting the Handle of a Child Window
There are two handles that a Declare writer may need when it comes to MDIWindows. The Handle property returns the frame window's handle. If you want the MDICLIENT handle for doing things like cascading child windows, then you need to get the child window based on the Handle with a code snippet like this:
Private Dim mClientHandle as Integer
Function MDIClientHandle(extends w as MDIWindow) As Integer
// There's two different handles used for an MDI window. The frame
// handle (which is MDIWindow.Handle), and the client handle. This
// gets the client handle, which is used for things like tiling or cascading
// child windows.
If mClientHandle <> 0 then return mClientHandle
#if TargetWin32
Declare Sub EnumChildWindows Lib "User32" ( parent as Integer,_
proc as Ptr,lParam as Integer )
mClientHandle = 0
// Do the enumeration
EnumChildWindows( w.Handle, AddressOf enumChildProc, 0 )
// Return the client's handle
Return mClientHandle
#endif
End Function
Function enumChildProc(hwnd as Integer, lParam as Integer) As Boolean
#if TargetWin32
// We need to figure out what class this window belongs to
Soft Declare Function GetClassNameW Lib "User32" ( hwnd as Integer,_
name as Ptr, count as Integer) as Integer
Soft Declare Function GetClassNameA Lib "User32" ( hwnd as Integer,_
name as Ptr, count as Integer ) as Integer
Dim classNamePtr as New MemoryBlock( 256 )
Dim className as String
if System.IsFunctionAvailable( "GetClassNameW", "User32" ) then
Dim cnt as Integer = GetClassNameW( hwnd, classNamePtr,_
classNamePtr.Size )
className = classNamePtr.WString( 0 )
else
Dim cnt as Integer = GetClassNameW( hwnd, classNamePtr,_
classNamePtr.Size )
className = classNamePtr.CString( 0 )
end if
// If the name is MDICLIENT, then we're done
If className = "MDICLIENT" then
mClientHandle = hwnd
Return False
end if
Return True
#endif
End Function
End Module
Example
The following code in the Open event of the App class (which is added to your project by default) sets some properties of the MDI window:
See Also
Application class; App object.